<template>
    <view class="body">
        <!-- <rf-nav-bar class="head_bar" color="color: #111110;" backgroundColor="#fff" :title="title" /> -->
        <view class="backTitle">
            <image class="bg-image" src="../../static/icon/p_040.png" mode="widthFix"></image>
            <view class="titleLeft">
                <p>用户编号：{{dataFile.dataMap.merchantNo}}</p>
                <p>卡编号：{{dataFile.dataMap.snCode}}</p>
            </view>
        </view>

        <view class="uTabs flex-center-center">
            <view class="justTab" v-for="(item,index) in list" :key="index" @click="selected(item)">
                <p :class="{'active' : active ==(index+1)}"> {{item.name}}</p>
            </view>
        </view>

        <view class="contain ">
            <view class="justDiv flex-center" v-for="(item,index) in dataFile.content" :key="index"
                @click="selected1(item)" :class="{'active1' : active1 ==(index+1)}">
                <view class="justCon">
                    <p>当前套餐：{{item.comboName}}</p>
                    <p>
                        当月已用：{{item.useFlow}}/{{item.unit}}
                    </p>
                    <p>
                        结束时间：{{item.time}}
                    </p>
                </view>
            </view>
        </view>

    </view>
</template>

<script>
    import rfNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue';
    import {
        comboList
    } from '@/common/api.js'
    export default {
        components: {
            rfNavBar
        },
        data() {
            return {
                title: '套餐查询',

                list: [{
                    name: '已生效',
                    statu: 1,
                }, {
                    name: '未使用',
                    statu: 2,
                }, {
                    name: '已失效',
                    statu: 3,
                }, ],
                active: 1,
                active1: 1,
                dataFile: "",

                merchantId: '',
                status: 1
            }
        },
        onLoad(options) {
            this.merchantId = options.merchantId
            this.intoData(options)
        },
        methods: {
            intoData() {
                let params = {
                    "merchantId": this.merchantId,
                    "pageNum": 1,
                    "pageSize": 50,
                    "status": this.status
                }
                comboList(params).then((res) => {
                    this.dataFile = res.data

                })
            },
            sectionChange(index) {
                this.curIndex = index;
                this.curNow = index;
            },
            selected(item) {
                console.log(item);
                this.active = this.status = item.statu
                this.intoData()

            },
            selected1(index) {
                this.active1 = index + 1


            },
            toPay() {}
        }
    }
</script>

<style lang="scss">
    .body {
        font-size: 28rpx;

        .active {
            border-bottom: 2px solid #517af1 !important;
            color: #517af1 !important;
        }



        .backTitle {
            background-color: #5079ed;
            height: 280rpx;
            width: 100%;
            // background-image: url("../../static/icon/p_040.png");
            // background-repeat: no-repeat;
            // background-size: 30%;
            // background-position: 250px 10rpx;
            position: relative;

            .bg-image {
                width: 30%;
                position: absolute;
                top: 50rpx;
                right: 20rpx;

            }

            .titleLeft {
                position: absolute;
                color: #fff;
                margin-left: 30rpx;
                font-weight: 600;
                padding-top: 110rpx;
            }
        }

        .uTabs {
            width: 100%;

            .justTab {
                width: 50%;
                height: 84rpx;
                display: flex;
                align-items: center;
                justify-content: center;
                border-bottom: 1px solid #f4f3f3;


                p {
                    text-align: center;
                    width: 35%;
                    line-height: 80rpx;
                    height: 80rpx;
                    font-weight: 500;
                    color: #999;
                    border-bottom: 2px solid #fff;
                }
            }
        }

        .comboTip {
            width: 98%;
            height: 80rpx;
            line-height: 80rpx;
            text-align: right;
            color: #5079ed;
            margin-right: 2%;
        }


        .contain {
            width: 98%;
            margin-left: 1%;

            .justDiv {
                border-radius: 20rpx;
                border: 3rpx solid #e7e7e7;
                width: 96%;
                margin: 20rpx 2%;
                padding: 15rpx 0;
                color: #999;
                background-color: #fafafa;

                .justCon {
                    font-weight: 600;
                    color: #333;
                    margin-left: 20rpx;

                    p {
                        margin: 18rpx;
                    }
                }

            }

        }


    }
</style>